using System;
using System.Linq.Expressions;
using System.Windows.Controls;
using System.Windows.Data;

namespace FluentSilverlight.Binders
{
    public class TextBlockBinder<TModel> : FrameworkElementBinder<TextBlockBinder<TModel>, TextBlock, TModel>
        where TModel : class
    {
        public TextBlockBinder(TModel model, TextBlock control)
            : base(model, control)
        { }

        public TextBlockBinder<TModel> Text(Expression<Func<TModel, object>> expression)
        {
            propertyBinder.SetBinding(expression, TextBlock.TextProperty, BindingMode.OneWay);
            return this;
        }

        protected override TextBlockBinder<TModel> thisInstance()
        {
            return this;
        }
    }
}